<template>
  <div class="alarm">
    <div class="alarm-echarts">
      <Echarts :data="data" :color="color" :loading="loading" />
    </div>
    <div class="legend">
      <div class="label_item" v-for="(item, index) in data" :key="index">
        <span :style="{ background: item.color }" class="point"></span>{{ item.level }}
        <span :style="{ color: item.color }" class="number">{{ item.count }}</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts" name="OneEcharts">
import Echarts from "./Echarts.vue";
const props = defineProps({
  data: {
    type: Array as () => any,
    required: false,
    default: () => []
  },
  color: {
    type: Array as () => string[],
    required: false,
    default: () => []
  },
  loading: {
    type: Boolean,
    required: false,
    default: () => false
  }
});
console.log(props.data);
</script>

<style lang="scss" scoped>
.alarm {
  display: flex;
  align-items: center;
  width: 100%;
  height: 120px;
  margin-top: -10px;
  .alarm-echarts {
    width: 50%;
    height: 100%;
  }
  .legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 50%;
    height: 30%;
    margin-bottom: 50px;
    color: #000000;
  }
}
.label_item {
  width: 200px;
  height: 24px;
}
.point {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  margin-bottom: 3px;
  background: white;
  border-radius: 100%;
}
.number {
  margin-left: 10px;
  font-weight: 700;
}
</style>
